<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>西大网上书城 - 添加图书</title>
    <style>
        /* 基础样式重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "Microsoft YaHei", sans-serif;
        }

        body {
            background-color: #f0f2f5;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        /* 标题样式 */
        h1 {
            color: #2c3e50;
            margin: 20px 0 30px;
            font-size: 1.8rem;
            letter-spacing: 0.5px;
        }

        /* 表单容器 */
        .book-form-container {
            background-color: white;
            width: 100%;
            max-width: 500px;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
        }

        /* 表单组样式 */
        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: inline-block;
            width: 80px; /* 固定标签宽度，对齐更整齐 */
            color: #555;
            font-size: 1rem;
            vertical-align: top; /* 与输入框顶部对齐（适配多行文本） */
        }

        .form-control {
            width: calc(100% - 85px); /* 自适应剩余宽度 */
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 1rem;
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        .form-control:focus {
            outline: none;
            border-color: #4285f4; /* 聚焦时边框变蓝 */
            box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1); /* 轻微发光效果 */
        }

        /* 适配多行文本框 */
        .form-control.textarea {
            min-height: 80px;
            resize: vertical; /* 允许垂直拉伸 */
        }

        /* 提交按钮 */
        .submit-btn {
            width: 100%;
            padding: 12px;
            background-color: #34a853; /* 绿色按钮，象征成功添加 */
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 1rem;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.2s, transform 0.1s;
            margin-top: 10px;
        }

        .submit-btn:hover {
            background-color: #2d8f44; /*  hover时加深颜色 */
        }

        .submit-btn:active {
            transform: scale(0.99); /* 点击时轻微缩小，增强反馈 */
        }

        /* 响应式适配（小屏幕） */
        @media (max-width: 500px) {
            .form-group {
                display: flex;
                flex-direction: column;
                gap: 8px; /* 标签与输入框垂直间距 */
            }

            .form-group label {
                width: 100%; /* 标签占满宽度 */
            }

            .form-control {
                width: 100%; /* 输入框占满宽度 */
            }
        }
    </style>
</head>
<body>
<h1>欢迎访问西大网上书城</h1>

<div class="book-form-container">
    <form action="./addBook" method="post">
        <div class="form-group">
            <label for="name">书名：</label>
            <input type="text" id="name" name="name" class="form-control" placeholder="请输入书名">
        </div>

        <div class="form-group">
            <label for="author">作者：</label>
            <input type="text" id="author" name="author" class="form-control" placeholder="请输入作者">
        </div>

        <div class="form-group">
            <label for="price">价格：</label>
            <input type="text" id="price" name="price" class="form-control" placeholder="请输入价格">
        </div>

        <div class="form-group">
            <label for="memo">备注：</label>
            <textarea id="memo" name="memo" class="form-control textarea" placeholder="请输入备注信息"></textarea>
        </div>

        <div class="form-group">
            <label for="publish">日期：</label>
            <input type="text" id="publish" name="publish" class="form-control" placeholder="请输入出版日期">
        </div>

        <input type="submit" value="添加图书" class="submit-btn">
    </form>
</div>
</body>
</html>